Những câu hỏi liên quan
Lê Thế Phong
Xem chi tiết
Lê Thế Phong
21 tháng 1 2022 lúc 16:09

giúp với

 

Bình luận (0)
Nguyễn Lê Phước Thịnh
21 tháng 1 2022 lúc 22:01

#include <bits/stdc++.h>

using namespace std;

string st;

int d,i,dem;

int main()

{

cin>>st;

d=st.length();

dem=0;

for (i=0; i<d; i++)

if (st[i]=='0') dem++;

cout<<dem;

return 0;

}

Bình luận (0)
Kiều Vũ Linh
22 tháng 1 2022 lúc 8:33

Var n,dem:longint;

Begin

Write('Nhap so n = ');readln(n);

While n >= 10 do

Begin

if n mod 10 = 0 then dem:=dem+1;

n:=n div 10;

End;

Write('So vua nhap co ',dem,' so 0');

Readln;

End.

Bình luận (0)
Yna Lolipop
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 3 2022 lúc 23:11

1:

#include <bits/stdc++.h>

using namespace std;

long long dem,i,n,x;

int main()

{

cin>>n;

dem=0;

for (i=1; i<=n; i++)

{

cin>>x;

if (x%2==0) dem++;

}

cout<<dem;

return 0;

}

Câu 2: 

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,t;

int main()

{

cin>>n;

t=0;

for (i=1; i<=n; i++)

{

cin>>x;

if (x%3==0) t+=x;

}

cout<<t;

return 0;

}

Bình luận (0)
Danh hậu
Xem chi tiết
Nguyễn Lê Phước Thịnh
25 tháng 2 2023 lúc 15:21

uses crt;

var n,i,dem:integer;

begin

clrscr;

readln(n);

dem:=0;

for i:=1 to n do

if i mod 7=0 then inc(dem);

write(dem);

readln;

end.

Bình luận (0)
Nguyễn khánh thành
Xem chi tiết
Jhon wisk
Xem chi tiết
Nguyễn An Ninh
25 tháng 4 2023 lúc 10:01

#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n,dem=0,s=0;
    cin >> n;
    for (long long i=1;i<=n;i+=2){
        dem++;
        s+=i;
    }
    cout << "tu 0 den n co: " << dem << " so le" << endl;
    cout << "tong cac so le do la: " << s;
    return 0;

Bình luận (0)
Jhon wisk
Xem chi tiết
Jhon wisk
25 tháng 4 2023 lúc 9:54

#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n,dem=0,s=0;
    cin >> n;
    for (long long i=1;i<=n;i+=2){
        dem++;
        s+=i;
    }
    cout << "tu 0 den n co: " << dem << " so le" << endl;
    cout << "tong cac so le do la: " << s;
    return 0;
}

Bình luận (0)
Kiều Vũ Linh
25 tháng 4 2023 lúc 10:21

var i,n,d:integer;

s:longint;

begin

write('n = ');readln(n);

for i:=1 to n do

if i mod 2 <> 0 then

begin

d:=d+1;

s:=s+i;

end;

writeln('co ',d,' so le');

write('tong cac so le la ',s);

readln;

end.

Bình luận (0)
trần hoàng
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 4 2022 lúc 7:14

uses crt;

var n:string;

i,ln,nn,t,s,x,y:integer;

begin

clrscr;

readln(n);

writeln(length(n));

ln:=0;

nn:=9;

for i:=1 to length(n) do 

begin

val(n[i],x,y);

if ln<x then ln:=x;

if nn>x then nn:=x;

end;

writeln(ln);

writeln(nn);

t:=0;

s:=1;

for i:=1 to length(n) do 

begin

val(n[i],x,y);

t:=t+x;

s:=s*x;

end;

writeln(t);

writeln(s);

readln;

end.

Bình luận (0)
Do Ngoc Thao My
Xem chi tiết
Edward Paros
16 tháng 4 2023 lúc 22:05

program TimBoi4ChuSo;
var
  n, i: integer;
begin
  repeat
    writeln('Nhap vao so nguyen n (2<n<100): ');
    readln(n);
  until (n > 2) and (n < 100);
  
  writeln('Cac boi cua ', n, ' co 4 chu so la: ');
  for i := 1000 to 9999 do
  begin
    if i mod n = 0 then
      writeln(i);
  end;
end.

 

Bình luận (0)
vixdarius
Xem chi tiết
Minh Lệ
27 tháng 2 2021 lúc 17:12

Program HOC24;

var i,n,d,b,t: integer;

begin

write('Nhap so tu nhien N: '); readln(n);

d:=0; t:=0;

while n<>0 do

begin

b:=n mod 10;

d:=d+1;

t:=t+b;

n:=n div 10;

end;

writeln(n,' co ',d,' chu so');

write('Tong cac chu so chu n la: ',t);

readln

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
27 tháng 2 2021 lúc 18:48

*Cách khác

uses crt;

var n,i,d,x,y,t:integer;

st:string;

begin

clrscr;

write('Nhap n='); readln(n);

str(n,st);

d:=length(st);

writeln('So chu so cua ',n,' la: ',d);

t:=0;

for i:=1 to d do

  begin

val(st[i],x,y);

t:=t+x;

end;

writeln('Tong cac chu so cua ',n,' la: ',t);

readln;

end.

Bình luận (0)